//
//  MYGCloudDiskEditBriefVC.swift
//  MYDoctor
//
//  Created by Denny on 2024/3/15.
//

import UIKit

class MYGCloudDiskEditBriefVC: MYGBaseController {
    var farmerModel = MYCloudDiskContentModel()
    var content:String = "" {
        didSet {
            self.briefView.content = content
        }
    }
    lazy var briefView: MYGCloudDiskEditBriefView = {
        let control = Bundle.main.loadNibNamed("MYGCloudDiskEditBriefView", owner: nil)?.first as! MYGCloudDiskEditBriefView
        control.tapSureCallBack = {[weak self] text in
            guard let `self` = self else{return}
            self.submitContent(text: text)
        }
        return control
    }()
    
    func submitContent(text:String) {
        MYGLoading.show()
        MYGNetwork<MYGMeAPI,MYGEmptyModel>.request(target: .editNetDiskFolder(param: ["desc": text,
                                                                                      "type":"\(2)"], id: self.farmerModel.id)) {[weak self] item in
            self?.farmerModel.desc = text
            self?.navigationController?.popViewController()
            MYGLoading.hide()
        } failed: { _, msg in
            MMYGHUD.showToast(text: msg)
            MYGLoading.hide()
        }
    }
   
   
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "共享"
        self.view.addSubview(self.briefView)
        self.briefView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        // Do any additional setup after loading the view.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
